// Subscribe to HAL and monitor for cameras being added or removed
// Copyright 2006 (C) Ralph Thomas

#ifndef MISSION_APPS_PHOTO_HAL_H
#define MISSION_APPS_PHOTO_HAL_H

#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/signals.hpp>

namespace apps {
	namespace photo {
		struct camera_monitor_impl_t;
		//
		/// Connect to D-BUS and register for HAL notifications
		/// that a camera has been added or removed from the system.
		/// If D-BUS or HAL is unavailable then polling will be used.
		//
		class camera_monitor_t {
			camera_monitor_impl_t* impl_m;
			camera_monitor_t();
		  public:
			typedef boost::shared_ptr<camera_monitor_t>	camera_monitor_ptr_t;
			typedef boost::function<void ()>		change_func_t;
			typedef boost::signals::connection		connection_t;
			typedef boost::signals::scoped_connection	scoped_connection_t;
			virtual ~camera_monitor_t();
			//
			/// Return the instance of this singleton.
			///
			/// \return	our instance.
			//
			static camera_monitor_ptr_t get_instance();
			//
			/// Subscribe to be notified of cameras being added
			/// to the system.
			///
			/// \param	fn	the function to call when a
			///			camera is added to the system.
			/// \return	a connection object.
			//
			connection_t on_camera_add( const change_func_t& fn );
			//
			/// Subscribe to be notified of cameras being removed
			/// from the system.
			///
			/// \param	fn	the function to call when a
			///			camera is removed from the
			///			system.
			/// \return	a connection object.
			//
			connection_t on_camera_remove( const change_func_t& fn );
		};
	}
}

#endif

